<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>首页</title>
    <style>
        * {
            text-align: center;
            margin: 5px auto;
        }
    </style>
</head>
<body>
<h1>核酸检测系统</h1>
<form th:action="@{/index}" method="get">
    <select name="hospitalId">
        <option value="">请选择</option>
        <option th:each="h:${hospitalList}" th:value="${h.id}" th:text="${h.name}" th:selected="${h.id}==${hospitalId}"></option>
    </select>
    <input type="submit" value="查询">
</form>

<form th:action="@{/index/toAdd}" method="get">
    <input type="submit" value="添加">
</form>

<table border="1">
    <tr style="background-color: antiquewhite">
        <th>被检测人</th>
        <th>被检测人手机号</th>
        <th>被检测人身份证号</th>
        <th>检测机构</th>
        <th>检测日期</th>
        <th>检测结果</th>
        <th>操作</th>
    </tr>
    <tr th:each="m,stat:${page.list}" th:style="'background-color:'+ @{${stat.odd} ?'':'antiquewhite'}">
        <td th:text="${m.assayUser}"></td>
        <td th:text="${m.phone}"></td>
        <td th:text="${m.cardNum}"></td>
        <td th:text="${m.name}"></td>
        <td th:text="${#dates.format(m.assayTime,'yyyy-MM-dd')}"></td>
        <td th:text="${m.assayResult==0?'检测中':'确诊'}"></td>
        <td>
            <a th:href="@{/index/yes(id=${m.id})}" onclick="let yes=(confirm('请确认该检测者是否确诊?'));return yes">确诊</a>
        </td>
    </tr>
</table>
总页数：<span th:text="${page.pages}"></span>
总记录数：<span th:text="${page.total}"></span>
页面尺寸：<span th:text="${page.pageSize}"></span>
当前页记录数：<span th:text="${page.size}"></span>

<span th:if="${page.hasPreviousPage}">
    <a th:href="@{/index(pageNum=${page.pageNum -1})}">上一页</a>
</span>
&nbsp;
<span th:each="p:${page.navigatepageNums}">
    <a th:href="@{/index(pageNum=${p})}" th:text="${p}"></a>
</span>
<span th:if="${page.hasNextPage}">
    <a th:href="@{/index(pageNum=${page.pageNum +1})}">下一页</a>
</span>
</body>
</html>